#include <glib.h>

#include "mm.h"

int new_process(struct mm_ctrl *ctrl, uint32_t size, const char *process_name)
{
	g_message("enter func %s...", __func__);
	int ret = 0;
	if (NULL == ctrl) {
		g_message("%s -- allocate error!", __func__);
		return -1;
	}
	uint32_t start_addr = mm_ff(ctrl, size);
	if (-1 == start_addr) {
		g_message("%s -- mm_ff error!", __func__);
		return -1;
	}
	ret = mm_allocate(ctrl, start_addr, size, process_name);
	if (-1 == ret) {
		g_message("%s -- mm_allocate error!", __func__);
		return -1;
	}
	g_message("leave func %s...", __func__);
	return 0;
}
